import request from '@/utils/request'

// 查询预约列表
export function listYuyue(query) {
  return request({
    url: '/register/yuyue/list',
    method: 'get',
    params: query
  })
}

// 查询预约列表
export function getAllYuyue() {
  return request({
    url: '/register/yuyue/getall/getAll',
    method: 'get'
  })
}

// 查询预约详细
export function getYuyue(id) {
  return request({
    url: '/register/yuyue/' + id,
    method: 'get'
  })
}

// 新增预约
export function addYuyue(data) {
  return request({
    url: '/register/yuyue',
    method: 'post',
    data: data
  })
}

// 修改预约
export function updateYuyue(data) {
  return request({
    url: '/register/yuyue',
    method: 'put',
    data: data
  })
}

// 删除预约
export function delYuyue(id) {
  return request({
    url: '/register/yuyue/' + id,
    method: 'delete'
  })
}

export function getDepartmentList() {
  return request({
    url: '/department/department/list', // 修正路径
    method: 'get'
  })
}

export function getDoctorList() {
  return request({
    url: '/doctor/doctor/list', // 修正路径
    method: 'get'
  })
}

// 删除费用
export function delCostByParentId(parentId) {
  return request({
    url: `/cost/cost/deleteByParentId/${parentId}`,
    method: 'delete',
  });
}

// 删除问诊记录（通过挂号 ID 删除）
export function delConsultationByRegisterId(registerId) {
  return request({
    url: `/treatment/consultation/deleteByRegisterId/${registerId}`,
    method: 'delete',
  });
}
export function addConsultation(data) {
  return request({
    url: '/treatment/consultation',
    method: 'post',
    data: data
  })
}
